package com.javaAPI.demo7;

public class Test1 {
    public static void main(String[] args) {
        char[] c1 = {'a', 'b', 'c'};
        char[] c2 = {'a', 'b'};
        System.out.println(compare(c1,c2));

    }

    public static boolean compare(char[] c1, char[] c2) {

        //判断两个数组长度
        if (c1.length != c2.length) {
            return false;
        }
        int n = c1.length;
        while (n-- != 0) {
            //数组对应下标值是否相同
            if (c1[n] != c2[n]) {
                return false;
            }
        }
        //元素值相同发，返回true
        return true;
    }
}
